<?php
	namespace app\controllers\first_pra;
	use yii\web\Controller;
	use app\models\first_pra\customer;
	class SqlcustomerController extends Controller{
		public function actionIndex(){
			echo "hello sbb";
		}
		public function actionInsert($name){
			$customer = new customer();
			$customer->name=$name;
			$customer->save();
		}
		public function actionUpdate($id,$name){
			$customer = customer::find()->where(['id'=>$id])->one();
			$customer->name = $name;
			$customer->save();
		}
		public function actionDelete($id){
			$customer = customer::find()->where(['id'=>$id])->one();
			$customer->delete();
		}
		public function actionSelect_all(){
			$customers = customer::find()->asArray()->all();
			print_R($customers);
			return 1;
		}
		public function actionSelect_id($id){
			$customer = customer::find()->where(['id'=>$id])->asArray()->one();
			print_R($customer);
		}
		public function actionSelect_name($name){
			$customer = customer::find()->where(['like','name',$name])->asArray()->all();
			print_R($customer);
		}
	}
?>